<template>
  <div class="app-container">
    <div style="width: 1024px;margin: 0 auto">
    <el-form ref="submitParams" :model="submitParams" :rules="rules" label-width="120px">
      <el-row>
        <el-col :offset="6" :span="12">
          <el-form-item label="系统编号" prop="sysCode">
            <el-select v-model="submitParams.sysCode" placeholder="系统编号" style="width: 100%">
              <el-option
                v-for="dict in dictMap.SYS_CODE_310_312"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :offset="6" :span="12">
          <el-form-item label="原交易流水号" prop="oriId">
            <el-input v-model="submitParams.oriId" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :offset="6" :span="12">
          <el-form-item>
            <el-button type="primary" @click="submitForm" v-loading.fullscreen.lock="loading">提 交</el-button>
            <el-button @click="refresh">重 置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
  </div>
</template>

<script>
import { ccmsBusinessAccountQueryEntry } from "@/api/cnaps/ccms/320";
import { listPageMixin } from "@/libs/listPageMixin";
import BankBranchDialog from "@/views/components/BankBranchDialog";
import { getBankInfByBankCode } from "@/api/cnaps/common/bankInfo";
import { getOtherCustByActno } from "@/api/cnaps/common/custInfo";
export default {
  name: "CcmsBusinessAccountQueryEntry",
  mixins: [listPageMixin],
  components: { BankBranchDialog },
  data() {
    return {
      // 录入参数
      submitParams: {
        sysCode: "HVPS",
        oriId: undefined,
      },
      loading: false,
      //
      searchFormDictList: ["SYS_CODE_310_312"],

      rules: {
        oriId: [
          { required: true, message: "请输入原交易流水号", trigger: "blur" },
          { max: 20, message: "长度最大为20位", trigger: "blur" },
        ],
      },
    };
  },
  mounted() {},
  methods: {
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["submitParams"].validate((valid) => {
        if (valid) {
          this.loading = true;
          ccmsBusinessAccountQueryEntry(this.submitParams)
            .then((response) => {
              this.msgSuccess("录入成功");
              this.refresh();
              this.loading = false;
            })
            .catch((err) => {
              this.loading = false;
            });
        }
      });
    },
    //点击重置按钮
    refresh() {
      this.resetForm("submitParams");
    },

    checkbankcode: function () {
      var rcver = this.submitParams.rcver;
      this.submitParams.userInfo = { brno: "676" };
      getBankInfByBankCode(rcver)
        .then((response) => {
          if (response.code == "S" && response.result !== null) {
            this.$set(this.submitParams, "rcver", response.result.bankCode);
            this.$set(this.submitParams, "rcverDirect", response.result.drctBankCode);
            this.$set(this.submitParams, "rcverName", response.result.orgFullname);
          } else {
            this.msgError("无行名行号记录");
            this.$set(this.submitParams, "rcverDirect", null);
            this.$set(this.submitParams, "rcverName", null);
          }
        })
        .catch((err) => {
          this.msgError("无行名行号记录");
          this.$set(this.submitParams, "rcverDirect", null);
          this.$set(this.submitParams, "rcverName", null);
        });
    },
  },
};
</script>
